package learn_bouncycastle.security;

import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.apache.commons.codec.digest.DigestUtils;

public class SecMD5 {

	public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException {
		String s = "abc";

		System.out.println(
				new BigInteger(
								1, 
								MessageDigest.getInstance("MD5").digest(s.getBytes("utf8"))) // 16 byte 128 bit
				.toString(16));

		// ==================

		System.out.println(DigestUtils.md5Hex(s));
	}

}
